//
//  HomeCategoryCollectionViewCell.m
//  PaiLeXiongProject
//
//  Created by 小獾科技 on 2017/8/21.
//  Copyright © 2017年 小獾科技. All rights reserved.
//

#import "HomeCategoryCollectionViewCell.h"

@interface HomeCategoryCollectionViewCell ()


@end

@implementation HomeCategoryCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if(self = [super initWithFrame:frame])
    {
        _imgView = [UIImageView new];
        _imgView.userInteractionEnabled = YES;
        [self addSubview:_imgView];
        [_imgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.mas_centerX);
            make.top.equalTo(self).offset(20);
            make.width.equalTo(@50);
            make.height.equalTo(@50);
        }];
//        _imgView.layer.backgroundColor = ColorCyan.CGColor;
//        _imgView.layer.cornerRadius = 25;//切圆角 防止卡顿
        
        _nameLabel = [UILabel new];
        _nameLabel.text = @"外语";
        _nameLabel.textAlignment = 1;
        _nameLabel.font = PFMFONT(12);
        _nameLabel.textColor = ColorFrom16(0x656565);
        [self addSubview:_nameLabel];
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_imgView.mas_bottom).offset(10);
            make.centerX.equalTo(self);
            make.width.equalTo(@(GWIDTH/4));
            make.height.equalTo(@14);
        }];
        
    }
    return self;
}

- (void)setModel:(HomeIconModel *)model
{
    _model = model;
    [_imgView sd_setImageWithURL:[NSURL URLWithString:_model.imgurl] placeholderImage:nil];
    _nameLabel.text = _model.text;
}


@end
